﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class BalanceCenter_News : PageBase
{
    public string NewNews = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            BindData();
        }
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        isRequestLogin = true;
        RequestLoginPage = "BalanceCenter/News.aspx";

        base.OnInit(e);
    }

    #endregion

    private void BindData()
    {
        NewNews = PublicFunction.GetOptionsBin("滚动新闻");

        DataTable dt = DAL.Tables.T_News.Select("*", "isShow=1 and Type = 1", "[DateTime] desc");

        if (dt == null)
        {
            PublicFunction.GoError(ErrorNumber.DataReadWrite, "数据读写错误", this.GetType().BaseType.FullName);

            return;
        }

        this.g.DataSource = dt.DefaultView;
        g.DataBind();
    }

    protected void g_PageIndexChanged(object sender, System.EventArgs e)
    {
        g.CurrentPageIndex = ((DataGridPageChangedEventArgs)e).NewPageIndex;
        BindData();
    }
}